package com.imooc.course.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.imooc.course.service.ICourseService;
import com.imooc.dto.CourseDTO;
import com.imooc.dto.UserDTO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Auther: zhaozeyang
 * @Date: 2018/9/4 17:33
 * @Description:
 */
@RestController
public class CourseController {

    @Reference
    private ICourseService courseService;

    @GetMapping("/courses")
    public List<CourseDTO> courseList(HttpServletRequest request) {
        UserDTO userDTO = (UserDTO) request.getAttribute("user");
        return courseService.courseList();
    }
}
